###
# This software is provided 'as-is', without any express or implied
# warranty.  In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
# 
# 1. The origin of this software must not be misrepresented; you must not
#    claim that you wrote the original software. If you use this software
#    in a product, an acknowledgment in the product documentation would be
#    appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
#    misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
#
# Note: Some of the libraries GMEngine may link to may have additional
# requirements or restrictions.
#
###

cmake_minimum_required(VERSION 2.8)

set(NAME TrefallRL)
project(${NAME})

file(GLOB_RECURSE GLSL_SHADERS ${CMAKE_SOURCE_DIR}/bin/resources/shaders/*.*)
file(GLOB_RECURSE INI_CONFIGS ${CMAKE_SOURCE_DIR}/bin/resources/ini/*.ini)
file(GLOB_RECURSE MATERIAL_CONFIGS ${CMAKE_SOURCE_DIR}/bin/resources/materials/*.mat)

file(GLOB_RECURSE GL3_HEADER ${CMAKE_SOURCE_DIR}/depends/include/GL3/*.h)
file(GLOB_RECURSE GL_HEADER ${CMAKE_SOURCE_DIR}/depends/include/GL/*.h)
file(GLOB VIEWS_HEADER Views/*.h)
file(GLOB RENDER_HEADER Render/*.h)
file(GLOB FILE_HEADER File/*.h)
file(GLOB ROOT_HEADER *.h)

file(GLOB_RECURSE GL3_SOURCE ${CMAKE_SOURCE_DIR}/depends/include/GL3/*.c)
file(GLOB_RECURSE GL_SOURCE ${CMAKE_SOURCE_DIR}/depends/include/GL/src/*.c)
file(GLOB RENDER_SOURCE Render/*.cpp)
file(GLOB VIEWS_SOURCE Views/*.cpp)
file(GLOB FILE_SOURCE File/*.cpp)
file(GLOB ROOT_SOURCE *.cpp)

SOURCE_GROUP("Resource Files\\Shaders\\" FILES ${GLSL_SHADERS})
SOURCE_GROUP("Resource Files\\ini\\" FILES ${INI_CONFIGS})
SOURCE_GROUP("Resource Files\\Materials\\" FILES ${MATERIAL_CONFIGS})

SOURCE_GROUP("Header Files\\Depends\\Gl3" FILES ${GL3_HEADER})
SOURCE_GROUP("Header Files\\Depends\\GL" FILES ${GL_HEADER})
SOURCE_GROUP("Header Files\\Render" FILES ${RENDER_HEADER})
SOURCE_GROUP("Header Files\\Views" FILES ${VIEWS_HEADER})
SOURCE_GROUP("Header Files\\File" FILES ${FILE_HEADER})

SOURCE_GROUP("Source Files\\Depends\\Gl3" FILES ${GL3_SOURCE})
SOURCE_GROUP("Source Files\\Render" FILES ${RENDER_SOURCE})
SOURCE_GROUP("Source Files\\Views" FILES ${VIEWS_SOURCE})
SOURCE_GROUP("Source Files\\File" FILES ${FILE_SOURCE})

set(RESOURCES
	${GLSL_SHADERS}
	${INI_CONFIGS}
	${MATERIAL_CONFIGS}
)

set(HDRS
	${GL3_HEADER}
	${GL_HEADER}
	
	${RENDER_HEADER}
	${VIEWS_HEADER}
	${FILE_HEADER}
	${ROOT_HEADER}
)

set(SRCS
	${GL3_SOURCE}
	${GL_SOURCE}

	${RENDER_SOURCE}
	${VIEWS_SOURCE}
	${FILE_SOURCE}
	${ROOT_SOURCE}
)

add_executable(${NAME} ${RESOURCES} ${HDRS} ${SRCS})

find_package(OpenGL REQUIRED)
find_package(GLFW REQUIRED)
find_package(DevIL REQUIRED)

ADD_DEFINITIONS()

target_link_libraries(${NAME}
	OpenGL32
	debug ${GLFW_STATIC_DEBUG_LIBRARY} optimized ${GLFW_STATIC_RELEASE_LIBRARY}
	${IL_LIBRARY}
	${ILU_LIBRARY}
	${ILUT_LIBRARY}
)

